package ys.ewp.dto;

import java.util.Date;

import ys.ewp.po.Department;

public class DepartmentDto {
	
	//ID
	private Integer id;
	//部门名称
	private String name;
	//部门描述
	private String description;
	//创建时间
	private Date dateCreated;
	//更新时间
	private Date dateUpdated;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Date getDateCreated() {
		return dateCreated;
	}
	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}
	public Date getDateUpdated() {
		return dateUpdated;
	}
	public void setDateUpdated(Date dateUpdated) {
		this.dateUpdated = dateUpdated;
	}
	
	/**
	 * @功能 根据部门PO对象获得部门DTO对象
	 */
	public static DepartmentDto getDtoByPo(Department dep){
		DepartmentDto depDto = new DepartmentDto();
		
		depDto.setId(dep.getId());
		depDto.setName(dep.getName());
		depDto.setDescription(dep.getDescription());
		depDto.setDateCreated(dep.getDateCreated());
		depDto.setDateUpdated(depDto.getDateUpdated());
		
		return depDto;
	}
	
	/**
	 * @功能 根据员工DTO对象获得员工PO对象
	 */
	public static Department getPoByDto(DepartmentDto depDto){
		Department dep = new Department();
		
		dep.setName(depDto.getName());
		dep.setDescription(depDto.getDescription());
		dep.setDateCreated(depDto.getDateCreated());
		dep.setDateUpdated(depDto.getDateUpdated());
		
		return dep;
	}
	
}
